#include "LFileTrace.h"

namespace ln
{
    LFileTrace::LFileTrace()
        : m_file(NULL)
    {
        

    }

    void LFileTrace::Open(const wchar_t *_fileName, bool is_add /*= true*/)
    {
        if (is_add) {
            m_file = _wfopen(_fileName, L"a");
        } else {
            m_file = _wfopen(_fileName, L"w");
        }
    }


    LFileTrace::~LFileTrace()
    {
        Close();
    }

    void LFileTrace::WriteOne(const char *str)
    {
        int length = strlen(str);
        fwrite(str, 1, length, m_file);
    }

    void LFileTrace::Close()
    {
        if (m_file) {
            fclose(m_file);
            m_file = NULL;
        }

    }


}